NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
GdkEvent *event;
- /* Ignore new position during showing/hiding the window, otherwise we
- * would get the off-screen position that is used for hidden windows to
- * get reliable MouseEntered events when showing them again. See comments
- * in show() and hide().
- */
- if (inShowOrHide)
- return;
-
private->x = content_rect.origin.x;
private->y = _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height);
NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
GdkEvent *event;
private->width = content_rect.size.width;
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
- gboolean was_hidden;
- int requested_x = 0, requested_y = 0;
inShowOrHide = YES;
- was_hidden = FALSE;
-
- if (!GDK_WINDOW_IS_MAPPED (window))
- {
- NSRect content_rect;
- NSRect frame_rect;
-
- was_hidden = TRUE;
-
- /* We move the window in place if it's not mapped. See comment in
- * hide().
- */
- content_rect =
- NSMakeRect (private->x,
- _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
- private->width, private->height);
- frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
- [impl->toplevel setFrame:frame_rect display:NO];
-
- requested_x = frame_rect.origin.x;
- requested_y = frame_rect.origin.y;
- }
if (makeKey)
[impl->toplevel makeKeyAndOrderFront:impl->toplevel];
[impl->toplevel orderFront:nil];
inShowOrHide = NO;
-
- /* When the window manager didn't allow our request, update the position
- * to what it really ended up as.
- */
- if (was_hidden)
- {
- NSRect frame_rect;
-
- frame_rect = [impl->toplevel frame];
- if (requested_x != frame_rect.origin.x || requested_y != frame_rect.origin.y)
- {
- [self windowDidMove:nil];
- }
- }
}
- (void)hide
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
- NSRect content_rect;
- NSRect frame_rect;
inShowOrHide = YES;
-
- /* We move the window away when hiding, to make it possible to move it in
- * place when showing to get reliable tracking rect events (which are used
- * to generate crossing events). We have to do this, probably a bug in
- * quartz.
- */
- content_rect = NSMakeRect (-500 - private->width, -500 - private->height,
- private->width, private->height);
- frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
- [impl->toplevel setFrame:frame_rect display:NO];
-
[impl->toplevel orderOut:nil];
-
inShowOrHide = NO;
}
int style_mask;
const char *title;
- /* Big hack: We start out outside the screen and move the
- * window in before showing it. This makes the initial
- * MouseEntered event work if the window ends up right under
- * the mouse pointer, bad quartz.
- */
- content_rect = NSMakeRect (-500 - private->width, -500 - private->height,
- private->width, private->height);
+ content_rect = NSMakeRect (private->x,
+ _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
+ private->width,
+ private->height);
if (attributes->window_type == GDK_WINDOW_TEMP ||
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
[impl->toplevel setBackgroundColor:[NSColor clearColor]];
}
+ content_rect.origin.x = 0;
+ content_rect.origin.y = 0;
+
impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
[impl->view setGdkWindow:window];
[impl->toplevel setContentView:impl->view];
NSRect content_rect;
NSRect frame_rect;
- /* We don't update the NSWindow while unmapped, since we move windows
- * off-screen when hiding in order for MouseEntered to be triggered
- * reliably when showing windows and they appear under the mouse.
- */
- if (GDK_WINDOW_IS_MAPPED (window))
- {
- content_rect = NSMakeRect (private->x,
- _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
- private->width, private->height);
+ content_rect = NSMakeRect (private->x,
+ _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
+ private->width, private->height);
- frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
- [impl->toplevel setFrame:frame_rect display:YES];
- }
+ frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
+ [impl->toplevel setFrame:frame_rect display:YES];
}
else
{